<?php

namespace app\admin\model;

use app\index\model\PhotoList;
use think\Model;
use think\model\concern\SoftDelete;

class PhotoBuy extends Model
{
    use SoftDelete;
    protected $name = 'car_photo_buy';
    protected $autoWriteTimestamp = true;
    protected $dateFormat = 'Y/m/d H:i:s';
    protected $createTime = 'create_at';
    protected $updateTime = 'update_at';
    protected $deleteTime='delete_at';

    public function info() {
        return $this->hasOne(PhotoList::class, 'id', 'photo_id')->bind([
            'cover' => 'cover',
            'photo_name' => 'name',
        ]);
    }

    public function user()
    {
        return $this->hasOne(UserModel::class, 'id', 'userid');
    }
}